<?php




function SMSverify($mobile,$code){
	
	$account = "Meiyetong_CS";
	$password = "Myt82592";
	
	$url = "http://222.73.117.158/msg/HttpBatchSendSM?account={$account}&pswd={$password}"
			."&mobile={$mobile}&msg=您的账号验证码是：{$code}。请完成绑定&needstatus=true";
	
	$s = file_get_contents($url);
// 	echo $url ;
// 	var_dump($s);
}


function Encode($info){
	if(isset($_SERVER['HTTP_CODETYPE']) && strtolower($_SERVER['HTTP_CODETYPE'])=='json'){
		return json_encode(($info));
	}else{
		return json_encode(serialize($info));
	}
}

function LoadConfig(){
	global $_CLIENT;
	$client = $_GET['client'];
	
	$config = array();
	if(empty($_CLIENT[$client])){
		$config = $_CLIENT['DEMO'];
	}else{
		$config = $_CLIENT[$client];
	}
	
	C($config,'name');
	
	$hash = $_GET['hash'];
	
	if($hash != md5(date('Y').C('WX_APP_ID').$client) && C('VERIFY')){
// 	    echo json_encode(array('status'=>0,'msg'=>'非法来源.Code:'.md5(date('Y').C('WX_APP_ID').$client),'ref1'=>$client.date('Y').substr(C('WX_APP_ID'),0,5)));
// 	    exit();
	}
	
// 	/client/DEMO/hash/00d39a416b81ee29daec0278dcfe2d61
// 	/client/MYT/hash/fc63a32fdb586c153413643b4c019daa
	
// 	'DB_TYPE' => 'Sqlsrv', // 数据库类型
// 	'DB_HOST' => '120.24.209.218', // 服务器地址
// 	'DB_NAME' => '演示库', // 数据库名
// 	'DB_USER' => 'sa', // 用户名
// 	'DB_PWD' => 'Myt82592', // 密码
// 	'DB_PORT' => '1433', // 端口
// 	'DB_PREFIX' => '', // 数据库表前缀
// 	'WX_APP_ID'         	=> 'wx8efb53e8b54ec3fd',
// 	'WX_APP_SECRET'         => '8b68217b9def92d1a70aff9d49bdd53f',
	
// 	C('DB_NAME',$config['DB_NAME']);
}




function http($url , $POST){
	$ch_curl = curl_init ();
	curl_setopt ( $ch_curl, CURLOPT_TIMEOUT, 20);//3s
	curl_setopt ( $ch_curl, CURLOPT_HEADER, false );
	if(!empty($POST)){
		curl_setopt ( $ch_curl, CURLOPT_POST , 1);
		curl_setopt ( $ch_curl, CURLOPT_POSTFIELDS , ($POST));
	}else{
		curl_setopt ( $ch_curl, CURLOPT_POST , 0);
	}
	
	curl_setopt($ch_curl, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch_curl, CURLOPT_SSL_VERIFYHOST, false);
	
	curl_setopt ( $ch_curl, CURLOPT_RETURNTRANSFER, true );
	curl_setopt ( $ch_curl, CURLOPT_URL, $url );
	$str_return = curl_exec ( $ch_curl );
	
	var_dump($url);
	var_dump($POST);
	return $str_return;
}







